﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="icon"  />
<link href="http://www.zhuclass.com/img/icon.ico" type="image/x-icon" rel="shortcut icon"  />
<link rel="stylesheet" type="text/css" href="../../style/share/style.css">
<link rel="stylesheet" type="text/css" href="../../style/share/kczx.css">
<link rel="stylesheet" type="text/css" href="../../style/share/home_style.css">
<link rel="stylesheet" type="text/css" href="../../style/user.css">
<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<script type="text/javascript" src="../../js/home.js"></script>
<title>筑学堂家园个人空间</title>
<style type="text/css">
a {
	color:#222;
}
a:hover {
	color:#888;
}
li {
	list-style-type:none;
	border:none;
}
</style>

<script type="text/javascript">
    
     $(function(){
    	var activityId = "${activityId}";
    	if(null!=activityId && "" != activityId){
    		activityDetail(activityId);
    	}
     });
	    
	 function addActivity(){
		 $.ajax({ url: "../query_homeGroup_activity_add_page/${group_id}", 
		       success: function(result){
	              $("#mainPageDiv").html(result);
	           }
	     });	
	 }
	  
	 
	//群话题详细页面
	  function activityDetail(activity_id){
		 $.ajax({ url: "../query_homeGroup_activity_detail/"+activity_id, 
		       success: function(result){
	              $("#mainPageDiv").html(result);
	           }
	     });	
	 }
	
	//删除活动
	function deleteActivity(activity_id){
		 $.ajax({ url: "../delete_activity/"+activity_id+"/${group_id}", 
		       success: function(result){
	              alert(result);
	              if("success"==result){
	            	  $.ajax({ url: "../query_group_activity/${group_id}/1/${pageSize}", 
					       success: function(result){
				              $("#mainPageDiv").html(result);
				           }
				      });
	              }
	              
	           }
	     });	
	}
	
	//编辑
	function editActivity(activity_id){
		   $.ajax({ url: "../group_activity_edit_query/"+activity_id, 
		       success: function(result){
	           $("#mainPageDiv").html(result);
	        }
	       });
	}
	
	 //首页
	   function firstPage(){
		  $.ajax({ url: "../query_group_activity/${group_id}/1/${pageSize}", 
			       success: function(result){
		              $("#mainPageDiv").html(result);
		           }
		  });
		}
	 //上一页
	   function upPage(){
		      var pageNo = '${pageNo}';
		      var upNo = Number(pageNo) - 1 ;
		      if(Number(pageNo)>1){
		    	  $.ajax({ url: "../query_group_activity/${group_id}/"+upNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
			  
		}
	   //下一页
	   function nextPage(){
		      var pageNo = '${pageNo}';
		      var sumPageNum = '${sumPageNum}';
		      var nextNo = Number(pageNo) + 1 ;
		      if(Number(pageNo)<Number(sumPageNum)){
		    	  $.ajax({ url: "../query_group_activity/${group_id}/"+nextNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
		}
	   //跳转页
	   function gotoPage(obj){
		      var pageNo = $(obj).val();
			  $.ajax({ url: "../query_group_activity/${group_id}/"+pageNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			  });
		}
	
	
	</script>
</head>
<body style="align:center; padding:0;margin:0;clear:both; background-color:FFF;">
<div class="home_groupnotice" style="min-height:30px;">
		<c:if test="${isMember==0}">
			<a href="#"  onclick="addActivity()">
			<div class="pic_top02" style="position:relative;left:0px;top:10px;float:right;background-color:#209E85;color:#EEE"> <img src="../../images/add.png"> 添加活动 </div></a>
		</c:if>
		</div>
			<div class="home_groupnotice" style="min-height:20px;">
				<div class="home_grnottit"> 群组活动</div>
				<div class="home_groupnot"> 
					
					  <c:forEach items="${data.data}" var="li">
					  <div class="home_qz_div01" style="padding-bottom:20px;width:98%;border-bottom:1px dashed #DDD;"> <a href="#">
						<div class="home_hy_div0101" style="margin-top:5px;"> <img src="../../images/home_images/qz01.jpg"> </div>
						</a>
						<div class="home_groupact">
							<div style="width:98%;height:26px;">
								<div style="position:relative;float:left;width:450px;height:25px;font-size:14px;font-weight:bold"> <a href="#" onclick="activityDetail('${li.id}')"> ${li.activity_nm} </a></div>
								 <c:if test="${user_id==li.sponsor_id}">
								      <div style="float:right;font-size:12px;font-weight:100;">
								          <a href="#" style="color:#2CB8AD;" onclick="editActivity('${li.id}')"> [编辑]</a>
								          <a href="#" style="margin-left:8px;color:#2CB8AD;" onclick="deleteActivity('${li.id}')">[删除] </a>
								      </div>
								 </c:if>
								  <c:if test="${in_flag == 1}">
								      <div style="float:right;font-size:12px;font-weight:100;"><a href="#" style="color:#e2681f"  onclick="delMember(${li.member_id}"> 申请加入 </a></div>
								 </c:if>
							</div>
							<div style="height:20px;"> 所属群组： <a href="#">${li.group_nm} </a> </div>
							<div style="height:20px;"> 时间：${li.start_dt}至${li.end_dt} </div>
							<div style="height:20px;"> 参与人数：${li.count} <span style="margin-left:40px;"> 发起人： <a href="#">${li.sponsor_nm}</a></span> </div>
						</div>
					</div>
					   </c:forEach>
					
				</div>
				
				<!--页面切换-->
				<div class="page_div">
					<div class="page_body">
					    <a href="#"> 
					      <div class="kczx_divlb01" onclick="firstPage()" >首&nbsp;页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						  <div class="kczx_divlb01" onclick="upPage()" >上一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						 <div class="kczx_divlb01" onclick="nextPage()" >下一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						<select class="kczx_divlb01 page_select" onchange="gotoPage(this)" id="hostSelect">
						    <c:forEach begin="1" end="${sumPageNum}" var="i">  
							     <option value="${i}" <c:if test="${pageNo == i}"> selected="selected" </c:if>  >
							        第${i}页
							     </option>
						     </c:forEach> 
						</select>
					</div>
				</div>
				<!--end页面切换--> 
			</div>
</body>
</html>